<template>
    <view>
        <view class="flex-box flex-wrap plr30 flex-between pb50">
            <view class="xilu_goods mb35" v-for="(item,index) in list" @click="toDetail(item.id)">
                <view class="relative">
                    <image :src="item.thumb_image" mode="aspectFill" class="xilu_goods_pic"></image>
                    <view class="xilu_sold_out" v-if="item.sale_out_status==2"></view>
                </view>
                <view class="fs30 fwb m-ellipsis-l2 xilu_goods_title">{{item.name}}</view>
                <view class="flex-box flex-between flex-col-end fs24 ptb15">
                    <view class="red fs30"><text class="fs24">¥</text>{{item.salesprice}}</view>
                    <!-- <view class="col89">{{item.want_num}}人想要</view> -->
                </view>
                <view class="flex-box" v-if="item.user">
                    <image :src="item.user.avatar" mode="aspectFill" class="xilu_goods_avatar">
                    </image>
                    <view class="col5 fs28 m-ellipsis flex-grow-1">{{item.user.nickname}}</view>
                    <!-- <image src="../../static/icon/find_like-on.png" mode="aspectFill" class="xilu_find_like"></image> -->
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        name: "goodslist",
        props: {
            list: {
                default: [],
                type: Array
            },
            showCollect: {
                default: false,
                tyep: Boolean
            },
            showSaler: {
                default: true,
                tyep: Boolean
            }
        },
        data() {
            return {

            };
        },
        methods: {
            toDetail(id) {
                uni.navigateTo({
                    url: "/pages/goods_detail/goodsfw_detail?id="+id
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .xilu {
        &_goods {
            width: calc((100% - 30rpx) / 2);

            &_pic {
                width: 330rpx;
                height: 330rpx;
                border-radius: 20rpx;
                display: block;
                margin-bottom: 25rpx;
            }

            &_title {
                height: 68rpx;
                line-height: 34rpx;
            }

            &_avatar {
                width: 40rpx;
                height: 40rpx;
                border-radius: 50%;
                margin-right: 15rpx;
            }
        }

        &_find_like {
            width: 35rpx;
            height: 35rpx;
            margin-left: auto;
        }
        &_sold_out{
            width: 330rpx;
            height: 330rpx;
            background-image: url('../../static/icon/sold_out.png');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 240rpx 190rpx;
            position: absolute;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, .5);
            border-radius: 20rpx;
        }
    }
</style>
